﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;

namespace SalaDeEnsayo.ApplicationService
{
    public class SalaDeEnsayoPrincipal : IPrincipal
    {
        #region [VARs]

        MembershipService membershipService;

        #endregion

        #region [Constructor]

        public SalaDeEnsayoPrincipal(IIdentity identity, long usuarioId, IEnumerable<string> roles,bool activo)
        {
            this.Identity = identity;
            this.UsuarioId = usuarioId;
            this.Roles = roles;
            this.Activo = activo;
            this.membershipService = new MembershipService();
        }

        #endregion

        #region [Properties]

        public long UsuarioId { get; protected set; }

        public IEnumerable<string> Roles { get; protected set; }

        public bool Activo { get; protected set; }

        #endregion

        #region IPrincipal Members

        public IIdentity Identity { get; protected set; }

        public bool IsInRole(string role)
        {
            return this.Roles.Contains(role);
        }

        #endregion
    }
}
